package cn.wolfcode.trip.admin.controller;

import cn.wolfcode.trip.base.domain.Travel;
import cn.wolfcode.trip.base.query.TravelQueryObject;
import cn.wolfcode.trip.base.service.ITravelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/travelRelease")
public class TravelReleaseController {
    //注入service对象
    @Autowired
    private ITravelService travelService ;


    /**
     * 查询所有的游记
     */
    @RequestMapping("/list.do")
    public String list(Model model, @ModelAttribute("qo") TravelQueryObject qo){
        //查询全部的游记，这里面只查公开的，和状态为已发布的，还有就是
        qo.setState(Travel.STATE_RELEASE);//审核通过的
        qo.setIsPublic(true);//公开
        model.addAttribute("pageInfo",travelService.query(qo));
        return "travelRelease/list" ;
    }
}
